<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>教师信息</title>
	<meta name="decorator" content="default"/>
	<script src="${ctxStatic}/front/js/myValidate.js"></script> 
	<script type="text/javascript">
		$(document).ready(function() {
			$("#inputForm").validate({
				rules : {
					name : {
						maxlength : 4
					},
					schoolId: {
						required: true
					},
					sex : {
						required: true
					},
					contactPhone: {
						minlength : 10,
						maxlength : 13,
						isPhone:true
					}, 
					mobile :{
						isMobile:true
					}
				},
				messages : {
					name : {
						maxlength : '名字少于四个字'
					},
					schoolId: {
						required: "请选择"
					},
					sex : {
						required: "请选择"
					},
					contactPhone: {
						minlength : '固话为区号(3-4位)号码(7-9位)',
						maxlength : '固话最多为12位'
					}, 
					mobile :{
						digits : '手机号码只能为数字',
						minlength : '手机号码长度不能小于11位',
						maxlength : '手机号码长度不能大于11位'
					}
				},
				submitHandler: function(form){
					loading('正在提交，请稍等...');
					form.submit();
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text("输入有误，请先更正。");
					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});
		});
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li><a href="${ctx}/dd/ddTeacher/">教师列表</a></li>
		<li class="active"><a href="${ctx}/dd/ddTeacher/form?id=${ddTeacher.id}">教师<shiro:hasPermission name="dd:ddTeacher:edit">${not empty ddTeacher.id?'修改':'添加'}</shiro:hasPermission><shiro:lacksPermission name="dd:ddTeacher:edit">查看</shiro:lacksPermission></a></li>
	</ul><br/>
	<form:form id="inputForm" modelAttribute="ddTeacher" action="${ctx}/dd/ddTeacher/save" method="post" class="form-horizontal">
		<form:hidden path="id"/>
		<sys:message content="${message}"/>		
		<div class="control-group">
			<label class="control-label">
			<b style="color: red; font-size: large">*</b>所属学校：</label>
			<div class="controls">
				<%-- <form:input path="schoolId" htmlEscape="false" maxlength="32" class="input-xlarge " required="required"/> --%>
			 <form:select path="schoolId" class="input-mini form-control required ">
			                    <form:option value="">请选择</form:option>		
								<form:options items="${fns:getSchoolNameList()}" itemLabel="name"
									itemValue="id" htmlEscape="false" />
							</form:select>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">
			<b style="color: red; font-size: large">*</b>教师姓名：</label>
			<div class="controls">
				<form:input path="name" htmlEscape="false" maxlength="50" class="input-xlarge " required="required"/>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">
			<b style="color: red; font-size: large">*</b>住址：</label>
			<div class="controls">
				<form:input path="adress" htmlEscape="false" maxlength="50" class="input-xlarge " required="required"/>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">
			<b style="color: red; font-size: large">*</b>专业：</label>
			<div class="controls">
				<form:input path="major" htmlEscape="false" maxlength="100" class="input-xlarge " required="required"/>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">出生日期：</label>
			<div class="controls">
				<input name="birthday" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate " required="required"
					value="<fmt:formatDate value="${ddTeacher.birthday}" pattern="yyyy-MM-dd"/>"
					onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});"/>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">
			<b style="color: red; font-size: large">*</b>性别：</label>
			<div class="controls">
				<form:radiobuttons path="sex"
								items="${fns:getDictList('sex')}" itemLabel="label"
								itemValue="value" htmlEscape="false" class="" />
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">
			<b style="color: red; font-size: large">*</b>联系电话：</label>
			<div class="controls">
				<form:input path="contactPhone" htmlEscape="false" maxlength="20" class="input-xlarge " required="required"/>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">
			<b style="color: red; font-size: large">*</b>手机号码：</label>
			<div class="controls">
				<form:input path="mobile" htmlEscape="false" maxlength="20" class="input-xlarge " required="required"/>
			</div>
		</div>
		<div class="form-actions">
			<shiro:hasPermission name="dd:ddTeacher:edit"><input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>&nbsp;</shiro:hasPermission>
			<input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
		</div>
	</form:form>
</body>
</html>